package com.runtime;

import com.base.Constant;
import com.base.Sprite;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

public class Score extends Sprite {

    private int value;

    public void addScore() {
        value ++;
    }

    public void reset() {
        value = 0;
    }

    @Override
    public void draw(Graphics g) {
        Color oldColor = g.getColor();
        Font oldFont = g.getFont();
        g.setColor(Color.RED);
        g.setFont(new Font("楷体", Font.BOLD, 36));
        g.drawString(String.valueOf(value), Constant.WINDOW_WIDTH / 2, 60);
        g.setColor(oldColor);
        g.setFont(oldFont);
    }
}
